//
//  ChangeSexTableViewCell.m
//  LovingPartyBuilding
//
//  Created by 刘应平 on 17/5/4.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ChangeSexTableViewCell.h"

@implementation ChangeSexTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addSubview:self.sexImageView];
        [self addSubview:self.sexLabel];
        self.sexLabel.sd_layout
        .topSpaceToView(self,15 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self,40 * [UIScreen zj_screenWScale])
        .widthIs(100 * [UIScreen zj_screenWScale])
        .heightIs(30 * [UIScreen zj_screenHScale]);
        self.sexImageView.sd_layout
        .topSpaceToView(self,10 * [UIScreen zj_screenHScale])
        .rightSpaceToView(self,30 * [UIScreen zj_screenWScale])
        .heightIs(40 * [UIScreen zj_screenHScale])
        .widthIs(40 * [UIScreen zj_screenHScale]);
        
        UIView *under = [UIView new];
        under.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:under];
        under.sd_layout.leftEqualToView(self).bottomEqualToView(self).widthIs([UIScreen zj_screenWith]).heightIs(1.5);
        
    }
    return self;
}

- (void)setModel:(ChangeSexModel *)model{
    _model = model;
    self.sexLabel.text = model.title;
    if ([model.choose isEqualToString:@"1"]) {
        self.sexImageView.image = [UIImage imageNamed:@"option_normal"];
    }else{
        self.sexImageView.image = [UIImage imageNamed:@"option_default"];
    }
}
- (UILabel *)sexLabel{
    if (!_sexLabel) {
        _sexLabel = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor textBlackColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont systemFontOfSize:17 * [UIScreen zj_textFontScale]];
            label;
        });
    }
    return _sexLabel;
}

- (UIImageView *)sexImageView{
    if (!_sexImageView) {
        _sexImageView = [UIImageView new];
        _sexImageView.contentMode = UIViewContentModeCenter;
    }
    return  _sexImageView;
}
@end
